<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var i = 0;
    function foo() {

        i = i + 1;
        console.log(i)
    }

//        foo();
//        foo();
//        foo();
    setInterval(foo,1000);
    setInterval(foo,1000);
    setInterval(foo,1000);
</script>
</body>
</html>